package com.wjk.cms.controller;

import com.wjk.cms.common.Channel;
import com.wjk.cms.common.ControllerHelper;
import com.wjk.cms.pojo.User;
import com.wjk.cms.service.SecurityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;

public abstract class BaseController {

    @Autowired
    protected ControllerHelper controllerHelper;

    @Autowired
    protected SecurityService securityService;


    public String proceedUpload(MultipartFile file, String username, String category, String message) {
        return controllerHelper.proceedUpload(file, username, category, message);
    }

    protected User getCurrentUser() {
        return securityService.getCurrentUser();
    }

    protected String getChannel() {
        return Channel.get(Channel.NTC);
    }



    protected String clearUndefined(String str) {
        if (str == null) {
            return null;
        }
        if ("undefined".equalsIgnoreCase(str)) {
            return null;
        }
        return str;
    }

}
